import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Storage from 'vue-ls'

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css';

import demoBlock from './components/demo-block';
import hljs from 'highlight.js';
import 'highlight.js/styles/color-brewer.css'
// import MainFooter from './components/footer';
// import MainHeader from './components/header';
// import SideNav from './components/side-nav';
// import FooterNav from './components/footer-nav';

Vue.component('demo-block', demoBlock);
// Vue.component('main-footer', MainFooter);
// Vue.component('main-header', MainHeader);
// Vue.component('side-nav', SideNav);
// Vue.component('footer-nav', FooterNav);

import '@/assets/md-css.scss'

// import '../packages/theme-chalk/src/index.scss';
// import './demo-styles/index.scss';
import './assets/styles/common.less';
import './assets/styles/case.less';
// import './assets/styles/fonts/style.css';
import Antd, { version } from 'ant-design-vue'
import 'ant-design-vue/dist/antd.less' // or 'ant-design-vue/dist/antd.less'
// 导入组件库
import dataui from '../packages'


Vue.config.productionTip = false
Vue.use(Storage, {
  namespace: 'pro__', // key prefix
  name: 'ls', // name variable Vue.[ls] or this.[$ls],
  storage: 'local', // storage name session, local, memory
})
Vue.use(ElementUI, {size: 'small', zIndex: 3000})
Vue.use(Antd)
Vue.use(dataui)


router.afterEach(route => {
  Vue.nextTick(() => {
    const blocks = document.querySelectorAll('pre code:not(.hljs)');
    Array.prototype.forEach.call(blocks, hljs.highlightBlock);
  });
})

new Vue({
  router,
  store,
  render: function (h) { return h(App) }
}).$mount('#app')

Vue.filter('filterIdCard', function (value) {
  if (value) {
    if (typeof value === 'string') {
      return value.replace(/^(.{6})(?:\d+)(.{6})$/, '$1******$2')
    } else {
      return value
    }
  } else {
    return value
  }
})
Vue.filter('filterTel', function (value) {
  if (value) {
    if (typeof value === 'string') {
      if (value.length === 11) {
        return value.replace(/^(.{3})(?:\d+)(.{4})$/, '$1****$2')
      } else {
        return value
      }
    } else {
      return value
    }
  } else {
    return value
  }
})